This page contains information about project NuttX Support for Rapid Control Applications Development with pysimCoder applied by Michal Lenc for 2021 Google Summer of Code] under The Apache Foundation. The mentors of this project were Roberto Bucher, Pavel Píša and Brennan Ashton. In depth week by week update, including problems and demonstrations, can be found in NuttX Github issue GSoC: NuttX support for pysimCoder (info thread).

Project description

Main goal of the project was to integrate and test pysimCoder support for various kinds of drivers supported by NuttX RTOS. The main target platform was iMXRT1060 MCU, but STM32 platform (especially Nucleo F446RE board) was also used for testing and demonstration. The list of planned implementations included:

  • SocketCAN support
  • incremental encoder application demonstration with iMXRT MCU and DC motor
  • digital/analog converter and additional block for a test sensor
  • multiple channel PWM block
  • tickless mode support for iMXRT MCU in NuttX
  • current sensing support and demonstration on PMSM
Project evaluation

This section contains the list of tasks planned for the project during pre GSoC period indicates whether the taks were completed and merged to NuttX/pysimCoder mainline or not. Subsection Taks not set in pre GSoC period contains list of contributions that were done in results of regular discussions with mentors (block for DHTXX sensor, discrete PID block, TCP Socket TX) or because they were needed for the tasks defined in pre GSoC period (new IOCTL commands, Park and Clarke transformation, switch block). The only task set in pre GSoC period that was not completed is a PMSM control example. This was caused by the troubles I encountered with i.MX RT external ADC triggering from PWM. Implementation of this functionality took me more time than I expected and I did not have time to finish the application example by the end of GSoC Coding Period. The external ADC triggering is currently working in my forked repository (links below) but it is not in the state to be merged into the NuttX mainline.

Tasks set in pre GSoC period
  • SocketCAN support for pysimCoder
  • incremental encoder support for Teensy 4.x board in NuttX
  • DC motor control example
  • DAC block for pysimCoder
  • multiple channel PWM block for pysimCoder
  • PMSM control example
  • Tickless Mode support for iMXRT MCU in NuttX
  • Documentation for NuttX and pysimCoder integration
Optional tasks set in pre GSoC period
  • PWM driver support for iMXRT MCU in NuttX
  • demonstration on RISC-V boards (ESP32-C3 board)
Tasks not set in pre GSoC period
  • block for relational operations of two inputs
  • updated nuttx.tmf to respect linking by both GCC and plane LD
  • block for DHTXX sensor
  • switch block for two outputs
  • discrete PID block
  • TCP Socket TX block
  • added new IOCTL commands to NuttX ADC driver to reset FIFO queue and get number of samples waiting to be read
  • added new IOCTL command to NuttX PWM driver to get number of configured channels
  • blocks for Park and Clarke transformations
List of pull requests and commits to pysimCoder and NuttX
Repositories with the source code

This section contains the state of the NuttX and pysimCoder Github repositories at the end of GSoC period. Lots of commits in NuttX gsoc2021 branch is hidden behind the commits by other contributors, for full list of commits to NuttX please see the list above. NuttX branch includes configurations teensy-4.x:teensy-dc and teensy-4.x:pmsm. Teensy-dc configuration is tested with pysimCoder on a DC motor control, pmsm was not tested with real time control application as was mentioned before but single functionalities work fine.

Representative outputs from the project
Meetings

This section contains informations about weekly meetings with project mentors starting the first week of the coding period (meetings before the oficial start of GsoC are not mentioned here).

Meeting 01 – 10. 6. 2021
  • presented application for DC motor control with Nucleo F446RE
  • discussed ideas about implementing PSD controller block and anti windup block
  • discussed the process of implementating NuttX sensors drivers to pysimCoder
  • decision to store information about progress and meetings in pysimCoder wiki
Meeting 02 - 24. 6. 2021
  • presented contributions since last meeting (DHT sensor, DAC block, PWM multichannel block and PWM driver for iMXRT)
  • discussed the option to create a single block that would control DC motor
  • discussed the approach with current sensing testing and demonstration
Meeting 03 - 1. 7. 2021
  • presented implementation of TCPsocketTx block and real time plotter adjustment to receive data over TCP
  • discussed the tickless mode options in NuttX configuration
  • discussed options of implementing state space controllers
Meeting 04 - 8. 7. 2021
  • discussed possible aproaches what to do in blocks when initialization fails (current approach is to close the device and exit the application, but this might not be the best option when the problem occurs only in nonessential block like TCPsocketTX that sends data to the plotter)
  • presented changes to nuttx_ADC block (multiple channel output from ADC), discuss implementing some of the ADC parameters (number of channels, resolution) to block parameters
  • presented updates regarding the tickless mode for iMXRT MCU
Meeting 05 - 15. 7. 2021
  • presented finisheded tickless mode for iMXRT MCU
  • discuss upcoming PMSM demo application
Meeting 06 - 22. 7. 2021
  • discussed recent changes to PWM block and the approach to ADC multichannel block (resulted in adding new ioctl command for ADC driver and terminating loops in PWM drivers when channel number is -1)
  • discussed external hardware triggering for ADC
Meeting 07 - 5. 8. 2021
  • discussed NuttX Documentation for pysimCoder integration
  • presented current progress with PMSM application example
  • discusseded external hardware triggering for ADC
Meeting 08 - 12. 8. 2021
  • discussed future possibilities for NuttX and pysimCoder integration
  • discussed upcoming NuttX Worshop presentations
  • No labels